﻿using System;
using System.Windows;

namespace AdventureWorks.Client.Silverlight
{
    public partial class EmployeeSearch
    {
        partial void PostInitialize()
        {
            btnDetails.Click += new RoutedEventHandler(btnDetails_Click);
        }

        void btnDetails_Click(object sender, RoutedEventArgs e)
        {
            if (gridResults.SelectedIndex >= 0)
            {
                list.CurrentRow = gridResults.SelectedIndex;
                int? id = list.IdProperty.Value;
                if (id.HasValue)
                    NavigationService.Source = new Uri("/_EmployeeDetails.xaml?TemporaryKey&EmployeeId=" + id, UriKind.Relative);
            }
        }
    }
}
